<template>
  <div class="user-data-detail-dialog-page">
    <el-dialog
      :model-value="props.dialogVisible"
      title="数据详情"
      width="1200px"
      :close-on-click-modal="false"
      :before-close="handleClose">
      <div class="info-block">
        <el-row class="mt16" :gutter="16">
          <el-col class="info-item" :span="8" v-for="(item, index) in infoData" :key="index">
            <span class="label">{{item.label}}:</span>
            <span class="value">11</span>
          </el-col>
        </el-row>
      </div>

      <div class="mt16" style="display: flex;">
        <div style="width: 740px;">
          <el-table :data="tableData" class="nr-table">
            <el-table-column label="时长" prop="name" width="60px"></el-table-column>
            <el-table-column label="开始" prop="id" width="60px"></el-table-column>
            <el-table-column label="结束" prop="rtsp" width="60px"></el-table-column>
            <el-table-column label="状态" prop="phone" width="60px"></el-table-column>
            <el-table-column label="平均心率" prop="rtsp"></el-table-column>
            <el-table-column label="最大心率" prop="rtsp"></el-table-column>
            <el-table-column label="平均呼吸" prop="num"></el-table-column>
            <el-table-column label="最大呼吸" prop="num"></el-table-column>
            <el-table-column label="异常次数" prop="num"></el-table-column>
          </el-table>
          <!-- <el-pagination
            class="nr-page"
            v-model:current-page="searchParams.currentPage"
            v-model:page-size="searchParams.pageSize"
            :page-sizes="[10, 20, 30, 40]"
            background
            layout="total, prev, pager, next, sizes, jumper"
            :total="searchParams.total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange">
          </el-pagination> -->
        </div>
        <div style="width: 400px;margin-left: 16px;">
          <el-table :data="tableData" class="nr-table">
            <el-table-column label="时间" prop="name"></el-table-column>
            <el-table-column label="状态" prop="id"></el-table-column>
            <el-table-column label="心率" prop="rtsp"></el-table-column>
            <el-table-column label="呼吸" prop="phone"></el-table-column>
          </el-table>
          <el-pagination
            class="nr-page"
            v-model:current-page="searchParams.currentPage"
            v-model:page-size="searchParams.pageSize"
            :page-sizes="[10, 20, 30, 40]"
            background
            layout="pager"
            :total="searchParams.total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange">
          </el-pagination>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script setup lang="ts" name="UserDataDetailDialog">
import { ref, reactive, watch, ComponentInternalInstance, getCurrentInstance, onMounted, nextTick } from 'vue'
import { ElMessage, ElMessageBox, ElTable } from 'element-plus'

const { proxy } = getCurrentInstance() as ComponentInternalInstance

const emit = defineEmits(['update:dialogVisible'])
const props = defineProps({
  dialogVisible: {
    type: Boolean,
    default: false
  },
  formData: {
    type: Object,
    default: {}
  }
})

const infoData = ref<any>([
  { label: '设备名称', prop: '' },
  { label: '设备ID', prop: '' },
  { label: '监察日期', prop: '' },
  { label: '监察时间', prop: '' },
  { label: '监察对象', prop: '' },
])
const searchParams = reactive({
  currentPage: 1,
  pageSize: 10,
  total: 0
})
const tableData = ref<any>([
  { id: 1, name: '1', account: '1', phone: '138', num: 4 }
])

// 分页跳转
const handleCurrentChange = (val: number) => {

}
const handleSizeChange = (val: number) => {

}

// 关闭弹窗
const handleClose = () => {
  // tableData.value = []
  proxy?.$emit('update:dialogVisible', false)
}
</script>

<style lang="stylus" scoped>
@import '../../style/base.styl'

.user-data-detail-dialog-page
  .info-item
    margin-bottom 16px
    .label
      width 100px
      display inline-block
      text-align right
      color black
      font-weight bold
    .value
      margin-left 4px
</style>
